#!/usr/bin/python
# -*- coding:UTF-8 -*-
# @Time    : 2019/1/10 15:45
# @Author  : 王志鹏
# @Site    : 简单桶排序
# @File    : temp.py
# @Software: PyCharm

class Algorithm(object):
    def __init__(self):
        pass

    # 时间杂度 O(M+N)

    def main(self):
        list = [8, 5, 5, 2, 3]  # 范围0-10



        init = [0] * 11  # 初始化桶
        for i, v in enumerate(list):
            init[v] += 1

        # 小>大
        for i, v in enumerate(init):
            for j in range(v):
                print i,
        print
        # 小>大
        for i in range(len(init) - 1, -1, -1):
            for j in range(init[i]):
                print i,


if __name__ == '__main__':
    algorithm = Algorithm()
    algorithm.main()
